<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="java.util.*" %>
<%@ page import="org.news.entity.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/allNews.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/seleAllNews.js"></script>
<title>用户信息</title>
<%
     admin admin=(admin)session.getAttribute("userInfo");
     manager mg=(manager)request.getAttribute("mg");
%>
</head>
<body>
<!-- 页面头部   -->
<header id="header_div">
  <div class="container">
	<div class="logo left">
		<img src="${pageContext.request.contextPath}/img/logo2.jpg" width="700" height="90">
	</div>
	<ul class="right">	
	    <%if(admin==null){ %>
	    <li id="info1"><a href="${pageContext.request.contextPath}/view/login/login.jsp">登录？</a></li>
	    <%} else{%>
	    <li id="info1"><a href="${pageContext.request.contextPath}/view/login/login.jsp">欢迎您：<%=admin.getUname() %>[管理员]</a></li>
	    <%} %>
	    <li id="info2"><a href="${pageContext.request.contextPath}/view/login/addMg.jsp">马上注册</a></li>
		<li><a href="${pageContext.request.contextPath}/view/News/addNew.jsp">添加新闻</a></li>
		<li><a href="${pageContext.request.contextPath}/upAndDownServlet/allFiles">管理新闻文件</a></li>	
		<li><a href="${pageContext.request.contextPath}/index.jsp">返回主页</a></li>
	</ul>
  </div>
</header>
<!-- 大体部分 -->
<div id="table_div">
  <form style="width:350px;height:400px;margin:0px auto;">
	<p>&nbsp;</p>
	<p style="margin-top: 10px;">登录名：<input id="uid" value="<%=mg.getId()%>" readonly="readonly">(不可修改)</p>
	<p style="margin-top: 10px;margin-left: 15px;">姓名：<input id="uname" value="<%=mg.getUname()%>"></p>
	<p style="margin-top: 10px;margin-left: 15px;">密码：<input id="upwd" value="<%=mg.getUpwd()%>"></p>
    <button type="button" onclick="updateMgById() " style="width:20%;height: 30px;margin-left: 20%;margin-top: 20px;">确认修改</button>
    <button type="button" style="width:20%;height: 30px;margin-left: 5%;margin-top: 20px;"><a href="/NewsManager_SSM/admin/getAllManager" >返回</a></button>
  </form>
</div>
<!--页脚部分-->
<div id="footer">
	<div class="container">
		<p>
			<img src="img/i-f-logo.png"> <span>@2020 北京市xxxxxxx</span>
			 <a href="#">版权说明</a> <a href="#">版权说明</a> <a href="#">版权说明</a> 
			 <a href="#">版权说明</a> <a href="#">版权说明</a>
		</p>
	</div>
</div>
<script type="text/javascript">
function updateMgById() {
	//id是用户名
	var $uid=$("#uid").val();
	var $uname=$("#uname").val();
	var $upwd=$("#upwd").val();
	var check=confirm("确认修改吗？");
	if(check){
		$.ajax({
			url:"/NewsManager_SSM/admin/updateManagerById",
			type:"post",
			data:"uid="+$uid+"&uname="+$uname+"&upwd="+$upwd,  
			success:function(result,testStatus)
			{
				if(result == "1"){
					alert("修改成功");
					location.reload();
				}
			},
			error:function(xhr,errrorMessage,e){
				alert("系统异常！");
			}
		});
	}else{
		return false;
	}
	
	}
</script>
</body>
</html>